package com.practice.bootdemo.eventlistener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RedisMessageListener implements MessageListener {
 
    @Override
    public void onMessage(Message message, byte[] bytes) {
        String msg=new String(message.getBody());
        String channel=new String(bytes);
        System.out.println("监听Redis 消息队列 :".concat(channel).concat("的消息 :").concat(msg));
    }
}